Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickTime Components /
Chapter 3 - Standard Image-Compression Dialog Components


Summary of Standard Image-Compression Dialog Components

C Summary

Constants

/* component type value */
#define  StandardCompressionType    'scdi' /* standard image-compression
                                              dialog component type */
#define  StandardCompressionSubType 'imag' /* standard image-compression
                                              dialog component subtype */
/* preference flags */
#define  scListEveryCodec           (1L<<1)     /* list all components */
#define  scAllowZeroFrameRate       (1L<<2)     /* allow 0 frame rate */
#define  scAllowZeroKeyFrameRate    (1L<<3)     /* allow 0 key frame rate */
#define  scShowBestDepth            (1L<<4)     /* allow "best depth" */
#define  scUseMovableModal          (1L<<5)     /* use movable dialog */

/* values for testFlags parameter of functions that set test image */
#define  scPreferCropping           (1<<0)         /* crop image to fit */
#define  scPreferScaling            (1<<1)         /* shrink image to fit */
#define  scPreferScalingAndCropping (scPreferScaling + scPreferCropping)
                                                   /* shrink then crop */

/* dimensions of the test image portion of the dialog box */
#define  scTestImageWidth           80    /* test width of image */
#define  scTestImageHeight          80    /* test height of image */

/* possible items returned by hook function */
#define  scOKItem                   1     /* user clicked OK */
#define  scCancelItem               2     /* user clicked Cancel */
#define  scCustomItem               3     /* user clicked custom button */

/* result returned when user canceled */
#define  scUserCancelled            1     /* user canceled dialog */
/* selectors for standard image-compression dialog components */
#define  scPositionRect             2     /* SCPositionRect */
#define  scPositionDialog           3     /* SCPositionDialog */
#define  scSetTestImagePictHandle   4     /* SCSetTestImagePictHandle */
#define  scSetTestImagePictFile     5     /* SCSetTestImagePictFile */
#define  scSetTestImagePixMap       6     /* SCSetTestImagePixMap */
#define  scGetBestDeviceRect        7     /* SCGetBestDeviceRect */
#define  scRequestImageSettings     10    /* SCRequestImageSettings */
#define  scCompressImage            11    /* SCCompressImage */
#define  scCompressPicture          12    /* SCCompressPicture */
#define  scCompressPictureFile      13    /* SCCompressPictureFile */
#define  scRequestSequenceSettings  14    /* SCRequestSequenceSettings */
#define  scCompressSequenceBegin    15    /* SCCompressSequenceBegin */
#define  scCompressSequenceFrame    16    /* SCCompressSequenceFrame */
#define  scCompressSequenceEnd      17    /* SCCompressSequencEnd */
#define  scDefaultPictHandleSettings18    /* SCDefaultPictHandleSettings */
#define  scDefaultPictFileSettings  19    /* SCDefaultPictFileSettings */
#define  scDefaultPixMapSettings    20    /* SCDefaultPixMapSettings */
#define  scGetInfo                  21    /* SCGetInfo */
#define  scSetInfo                  22    /* SCSetInfo */
#define  scNewGWorld                23    /* SCNewGWorld */

/* selectors included for compatibility with earlier linked version 
   of standard image-compression dialog component */
#define  scGetCompression        1        /* SCGetCompression */
#define  scShowMotionSettings    (1L<<0)  /* SCShowMotionSettings */
#define  scSettingsChangedItem   -1       /* SCSettingsChangedItem */

/* SCSetInfo and SCGetInfo request types */
#define  scSpatialSettingsType   'sptl'   /* spatial options */
#define  scTemporalSettingsType  'tprl'   /* temporal options */
#define  scDataRateSettingsType  'drat'   /* data rate */
#define  scColorTableType        'clut'   /* color table */
#define  scProgressProcType      'prog'   /* progress function */
#define  scExtendedProcsType     'xprc'   /* extended dialog */
#define  scPreferenceFlagsType   'pref'   /* preferences */
#define  scSettingsStateType     'ssta'   /* all settings */
#define  scSequenceIDType        'sequ'   /* sequence ID */
#define  scWindowPositionType    'wndw'   /* window position */
#define  scCodecFlagsType        'cflg'   /* compression flags */

Data Types

/* SCModelFilterProcPtr is a pointer to a filter function */
typedef pascal Boolean (*SCModalFilterProcPtr) (DialogPtr theDialog,
            EventRecord *theEvent, short *itemHit, long refcon);
/* SCModalHookProcPtr is a pointer to a hook function */
typedef pascal short (*SCModalHookProcPtr) (DialogPtr theDialog, 
            short itemHit, SCParams *params, long refcon);
/* spatial options structure with the spatial settings request */
typedef struct {
   CodecType      codecType;        /* compressor type */
   CodecComponent codec;            /* compressor */
   short          depth;            /* pixel depth */
   CodecQ         spatialQuality;   /* desired quality */
} SCSpatialSettings;
/* temporal options structure with the temporal settings request */
typedef struct {
   CodecQ   temporalQuality;           /* desired quality */
   Fixed    frameRate;                 /* frame rate */
   long     keyFrameRate;              /* key frame rate */
} SCTemporalSettings;
/* data rate options with the data rate settings request */
typedef struct {
   long     dataRate;               /* desired data rate */
   long     frameDuration;          /* frame duration */
   CodecQ   minSpatialQuality;      /* minimum value */
   CodecQ   minTemporalQuality;     /* minimum value */
} SCDataRateSettings;
/* extending the dialog box with the extended functions request */
typedef struct {
   SCModalFilterProcPtr    filterProc; /* filter function */
   SCModalHookProcPtr      hookProc;   /* hook function */
   long                    refcon;     /* reference constant */
   Str31                   customName; /* custom button name */
} SCExtendedProcs;
/* standard compression parameter block for compatibility with earlier
   linked version of standard image-compression dialog components */
typedef struct {
   long              flags;            /* control flags */
   CodecType         theCodecType;     /* compressor type */
   CodecComponent    theCodec;         /* specific compressor */
   CodecQ            spatialQuality;   /* spatial quality value */
   CodecQ            temporalQuality;  /* temporal quality value */
   short             depth;            /* pixel depth */
   Fixed             frameRate;        /* desired frame rate */
   long              keyFrameRate;     /* desired key frame rate */
   long              reserved1;        /* reserved--set to 0) */
   long              reserved2;        /* reserved--set to 0 */
} SCParams;

Standard Image-Compression Dialog Component Functions

Getting Default Settings for an Image or a Sequence

pascal ComponentResult SCDefaultPixMapSettings
(ComponentInstance ci, PixMapHandle src, 
short motion);
pascal ComponentResult SCDefaultPictHandleSettings 
(ComponentInstance ci, PicHandle srcPicture, short motion);
pascal ComponentResult SCDefaultPictFileSettings
(ComponentInstance ci, short srcRef, 
short motion);

Displaying the Standard Image-Compression Dialog Box

pascal ComponentResult SCRequestImageSettings
(ComponentInstance ci);
pascal ComponentResult SCRequestSequenceSettings
(ComponentInstance ci);

Compressing Still Images

pascal ComponentResult SCCompressImage
(ComponentInstance ci, PixMapHandle src, 
Rect *srcRect, ImageDescriptionHandle *desc, Handle *data);
pascal ComponentResult SCCompressPicture
(ComponentInstance ci, PicHandle srcPicture, PicHandle dstPicture);
pascal ComponentResult SCCompressPictureFile
(ComponentInstance ci, short srcRefNum, 
short dstRefNum);

Compressing Image Sequences

pascal ComponentResult SCCompressSequenceBegin
(ComponentInstance ci, PixMapHandle src, 
Rect *srcRect, ImageDescriptionHandle *desc);
pascal ComponentResult SCCompressSequenceFrame
(ComponentInstance ci, PixMapHandle src, 
Rect *srcRect, Handle *data, long *dataSize, short *notSyncFlag);
pascal ComponentResult SCCompressSequenceEnd
(ComponentInstance ci);

Working With Image or Sequence Settings

pascal ComponentResult SCGetInfo
(ComponentInstance ci, OSType type, void *info);
pascal ComponentResult SCSetInfo
(ComponentInstance ci, OSType type, void *info);

Specifying a Test Image

pascal ComponentResult SCSetTestImagePictHandle 
(ComponentInstance ci, PicHandle testPict, Rect *testRect, short testFlags);
pascal ComponentResult SCSetTestImagePictFile 
(ComponentInstance ci, short testFileRef, Rect *testRect, short testFlags);
pascal ComponentResult SCSetTestImagePixMap 
(ComponentInstance ci, PixMapHandle testPixMap, Rect *testRect, short testFlags);

Positioning Dialog Boxes and Rectangles

pascal ComponentResult SCPositionRect 
(ComponentInstance ci, Rect *rp, Point *where);
pascal ComponentResult SCPositionDialog 
(ComponentInstance ci, short id, Point *where);
pascal ComponentResult SCGetBestDeviceRect 
(ComponentInstance ci, Rect *r);

Utility Function

pascal ComponentResult SCNewGWorld
(ComponentInstance ci, GWorldPtr *gwp, 
Rect *rp, GWorldFlags flags);

Application-Defined Function

pascal short MyHook (DialogPtr theDialog, short itemHit, 
void *params, long refcon);

Pascal Summary

Constants

CONST
   {component type value}
   StandardCompressionType    =  'scdi';  {standard image-compression }
                                          { dialog component type}
   StandardCompressionSubType =  'imag';  {standard image-compression }
                                          { dialog component subtype}
   {preference flags}
   scListEveryCodec        = $2;    {list all components}
   scAllowZeroFrameRate    = $4;    {allow 0 frame rate}
   scAllowZeroKeyFrameRate = $8;    {allow 0 key frame rate}
   scShowBestDepth         = $10;   {allow "best depth"}
   scUseMovableModal       = $20;   {use movable dialog box}
   {values for testFlags parameter of functions that set test image}
   scPreferCropping           = 1;  {crop image to fit}
   scPreferScaling            = 2;  {shrink image to fit}
   scPreferScalingAndCropping = 3;  {shrink then crop}
   {dimensions of the test image portion of the dialog box}
   scTestImageWidth     = 80; {test width of image}
   scTestImageHeight    = 80; {test height of image}
   
   {possible items returned by hook function}
   scOKItem       = 1;     {user clicked OK}
   scCancelItem   = 2;     {user clicked Cancel}
   scCustomItem   = 3;     {user clicked custom button}

   {result returned when user canceled}
   scUserCancelled   =  1; {user canceled dialog}
   {selectors for standard image-compression dialog components}
   kScPositionRect               =  2;    {SCPositionRect}
   kScPositionDialog             =  3;    {SCPositionDialog}
   kScSetTestImagePictHandle     =  4;    {SCSetTestImagePictHandle}
   kScSetTestImagePictFile       =  5;    {SCSetTestImagePictFile}
   kScSetTestImagePixMap         =  6;    {SCSetTestImagePixMap}
   kScGetBestDeviceRect          =  7;    {SCGetBestDeviceRect}
   kScRequestImageSettings       =  $A;   {SCRequestImageSettings}
   kScCompressImage              =  $B;   {SCCompressImage}
   kScCompressPicture            =  $C;   {SCCompressPicture}
   kScCompressPictureFile        =  $D;   {SCCompressPictureFile}
   kScRequestSequenceSettings    =  $E;   {SCRequestSequenceSettings}
   kScCompressSequenceBegin      =  $F;   {SCCompressSequenceBegin}
   kScCompressSequenceFrame      =  $10;  {SCCompressSequenceFrame}
   kScCompressSequenceEnd        =  $11;  {SCCompressSequenceEnd}
   kScDefaultPictHandleSettings  =  $12;  {SCDefaultPictHandleSettings}
   kScDefaultPictFileSettings    =  $13;  {SCDefaultPictFileSettings}
   kScDefaultPixMapSettings      =  $14;  {SCDefaultPixMapSettings}
   kScGetInfo                    =  $15;  {SCGetInfo}
   kScSetInfo                    =  $16;  {SCSetInfo}
   kScNewGWorld                  =  $17;  {SCNewGWorld}

   {selectors included for compatibility with earlier linked version }
   { of standard image-compression dialog component}
   kScShowMotionSettings         =  1; {SCShowMotionSettings}
   kScGetCompression             =  1; {SCGetCompression}
   kScSettingsChangedItem        = -1; {SCSettingsChangedItem}

   {SCSetInfo and SCGetInfo request types}
   scSpatialSettingsType      =  'sptl';  {spatial options}
   scTemporalSettingsType     =  'tprl';  {temporal options}
   scDataRateSettingsType     =  'drat';  {data rate}
   scColorTableType           =  'clut';  {color table}
   scProgressProcType         =  'prog';  {progress function}
   scExtendedProcsType        =  'xprc';  {extended dialog}
   scPreferenceFlagsType      =  'pref';  {preferences}
   scSettingsStateType        =  'ssta';  {all settings}
   scSequenceIDType           =  'sequ';  {sequence ID}
   scWindowPositionType       =  'wndw';  {window position}
   scCodecFlagsType           =  'cflg';  {compression flags}

Data Types

TYPE
   {SCModelFilterProcPtr is a pointer to a filter function}
   SCModalFilterProcPtr = ProcPtr;
   {SCModalHookProcPtr is a pointer to a hook function}
   SCModalHookProcPtr = ProcPtr;
   {spatial options structure with the spatial settings request}
   SCSpatialSettings = 
   RECORD 
      cType:            CodecType;        {compressor type}
      codec:            CodecComponent;   {compressor}
      depth:            Integer;          {pixel depth}
      spatialQuality:   CodecQ;           {desired quality}
   END;
   {temporal options structure with the temporal settings request}
   SCTemporalSettings = 
   RECORD
      temporalQuality:  CodecQ;     {desired quality}
      frameRate:        Fixed;      {frame rate}
      keyFrameRate:     LongInt;    {key frame rate}
   END;
   {data rate options with the data rate settings request}
   SCDataRateSettings = 
   RECORD 
      dataRate:            LongInt;    {desired data rate}
      frameDuration:       LongInt;    {frame duration}
      minSpatialQuality:   CodecQ;     {minimum value}
      minTemporalQuality:  CodecQ;     {minimum value}
   END;
   {extending the dialog box with the extended functions request}
   SCExtendedProcs = 
   RECORD 
      filterProc:    SCModalFilterProcPtr;{filter function}
      hookProc:      SCModalHookProcPtr;  {hook function}
      refCon:        LongInt;             {reference constant}
      customName:    Str31;               {custom button name}
   END; 
   {standard compression parameter block included for compatibility }
   { with earlier linked version of standard-image compression dialog }
   { component}
   SCParams = 
   RECORD
      flags :           LongInt;          {control flags}
      theCodecType:     CodecType;        {compressor type}
      theCodec:         CodecComponent;   {specific compressor}
      spatialQuality:   CodecQ;           {spatial quality value}
      temporalQuality:  CodecQ;           {temporal quality value}
      depth:            Integer;          {pixel depth}
      frameRate:        Fixed;            {desired frame rate}
      keyFrameRate:     LongInt;          {desired key frame rate}
      reserved1:        LongInt;          {reserved--set to 0}
      reserved2:        LongInt;          [reserved--set to 0}
   END;

Standard Image-Compression Dialog Component Routines

Getting Default Settings for an Image or a Sequence

FUNCTION SCDefaultPixMapSettings
(ci: ComponentInstance; src: PixMapHandle;
motion: Boolean): ComponentResult;
FUNCTION SCDefaultPictHandleSettings
(ci: ComponentInstance; src: PicHandle; 
motion: Boolean): ComponentResult;
FUNCTION SCDefaultPictFileSettings
(ci: ComponentInstance; srcRef: Integer; motion: Boolean): ComponentResult;

Displaying the Standard Image-Compression Dialog Box

FUNCTION SCRequestImageSettings
(ci: ComponentInstance): ComponentResult;
FUNCTION SCRequestSequenceSettings
(ci: ComponentInstance): ComponentResult;

Compressing Still Images

FUNCTION SCCompressImage (ci: ComponentInstance; src: PixMapHandle; 
srcRect: Rect; 
VAR desc: ImageDescriptionHandle; 
VAR data: Handle): ComponentResult;
FUNCTION SCCompressPicture(ci: ComponentInstance; src, dst: PicHandle): 
ComponentResult;
FUNCTION SCCompressPictureFile
(ci: ComponentInstance; srcRef, 
dstRef: Integer): ComponentResult;

Compressing Image Sequences

FUNCTION SCCompressSequenceBegin
(ci: ComponentInstance; src: PixMapHandle; srcRect: Rect; 
VAR desc: ImageDescriptionHandle): ComponentResult;
FUNCTION SCCompressSequenceFrame
(ci: ComponentInstance; src: PixMapHandle; srcRect: Rect; VAR data: Handle; 
VAR dataSize: LongInt; 
VAR notSyncFlag: Boolean): ComponentResult;
FUNCTION SCCompressSequenceEnd
(ci: ComponentInstance): ComponentResult;

Working With Image or Sequence Settings

FUNCTION SCGetInfo(ci: ComponentInstance; infoType: OSType; 
info: Ptr): ComponentResult;
FUNCTION SCSetInfo(ci: ComponentInstance; infoType: OSType; 
info: Ptr): ComponentResult;

Specifying a Test Image

FUNCTION SCSetTestImagePictHandle 
(ci: ComponentInstance; testPict: PicHandle; testRect: RectPtr; testFlags: Integer): ComponentResult;
FUNCTION SCSetTestImagePictFile
(ci: ComponentInstance; testFileRef: Integer; testRect: RectPtr; testFlags: Integer): ComponentResult;
FUNCTION SCSetTestImagePixMap
(ci: ComponentInstance; 
testPixMap: PixMapHandle; testRect: RectPtr; 
testFlags: Integer): ComponentResult;

Positioning Dialog Boxes and Rectangles

FUNCTION SCPositionRect(ci: ComponentInstance; r: RectPtr;
VAR where: Point): ComponentResult;
FUNCTION SCPositionDialog(ci: ComponentInstance; id: Integer; 
VAR where: Point): ComponentResult;
FUNCTION SCGetBestDeviceRect
(ci: ComponentInstance; r: RectPtr):
ComponentResult;

Utility Function

FUNCTION SCNewGWorld(ci: ComponentInstance; VAR gwp: GWorldPtr; 
VAR rp: Rect; flags: GWorldFlags):
ComponentResult;

Application-Defined Routine

FUNCTION MyHook(theDialog: DialogPtr; itemHit: Integer; 
params Ptr; refcon: LongInt): Integer;

Result Codes
scTypeNotFoundErr-8971Component does not have the information you want


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help